import service from '@/utils/request'

export const useDictTypeAllApi = () => {
	return service.get('/sys/dict/type/all')
}

// 获取所有的字典
export const useDictTypeListApi = () => {
	return service.get('/empi/dict/getALL')
}

export const useDictTypeApi = (id: Number) => {
	return service.get('/sys/dict/type/' + id)
}

export const useDictTypeSubmitApi = (dataForm: any) => {
	if (dataForm.id) {
		return service.put('/sys/dict/type', dataForm)
	} else {
		return service.post('/sys/dict/type', dataForm)
	}
}

export const useDictDataApi = (id: Number) => {
	return service.get('/sys/dict/data/' + id)
}

export const useDictDataSubmitApi = (dataForm: any) => {
	if (dataForm.id) {
		return service.put('/sys/dict/data', dataForm)
	} else {
		return service.post('/sys/dict/data', dataForm)
	}
}

export const useDictProviceApi = (params) => {
	return service.get('/sys/dict/data/page?' + params)
}

// sys 按类型获取所有的字典
export const useDictTypeAllSysApi = (data) => {
	return service({
		url: '/sys/dict/data/getByDictType',
		method: 'get',
		params: data
	})
}

// 行政区划字典
export const useDictProviceSysApi = (params) => {
	return service({
		url: '/empi/area/getData',
		method: 'get',
		params: params
	})
}
